package com.example.leave.common;

import com.example.leave.form.PageInfoForm;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;


public class PageUtil {
    public static Pageable pageInfoToPageable(PageInfoForm pageInfoForm) {
        return PageRequest.of(pageInfoForm.getNumber(),
                pageInfoForm.getSize(), Sort.by(pageInfoForm.getSort().getDirection(), pageInfoForm.getSort().getProperties()));
    }
}
